#!/usr/bin/env node

const fs = require('fs');
const file = process.argv[2];

//const rs = fs.createReadStream(file);

if(!fs.existsSync(file)){
  console.error('%s NOT EXIST',file);
  process.exit(1);
}
if(!fs.statSync(file).isFile()){
  console.error('%s IS NOT A FILE',file);
  process.exit(2);
}



//rs.on('error',(e)=>{
//  console.error(e.message);
//});
//rs.pipe(process.stdout);

fs.createReadStream(file).pipe(process.stdout);
